﻿@model bool

@{
    ViewBag.Title = "Forgotten Password";
}

<!-- Div wrapper2 starts here -->
<div id="Wrapper2">
    <div id="content_header">
        <div id="headerimage">
        </div>
        <div id="theheader">@ViewBag.Header</div>
    </div>
    <!-- Sidebar Element Starts Here -->
    <aside id="sidebar-wrapper">
        <nav class="sidebar">
            @if(!Model)
            {
                <h2>Forgotten Username and Password</h2>
                <p>
                    Please enter your email address. The system will email your username and password to the specified address.
                </p>

                using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { id = "form" }))
                {
                    <div>
                        <fieldset>
                            <legend>Email Address</legend>

                            <div class="editor-label">
                                Email: 
                            </div>
                            <div class="editor-field">
                                <input type="text" id="email" name="email" />
                            </div>
                            <div>
                                <input type="image" src="../../images/sendemailicon.png" value="Submit" />
                            </div>
                            <span id="formError" style="color:red; visibility:hidden">Please enter a valid email address.</span>
                        </fieldset>
                    </div>
                }
            }
            else
            {
                <p>Thank you. An email has been sent to the specified address.</p>
            }
            @Html.ActionLink("Return to Login", "LogOn", "Account")
        </nav>
        
        <!-- Sidebar Element Ends Here -->
    </aside>
    <!-- Another Sidebar Element Ends Here -->
    <!-- Main view container starts -->
    <article id="contents">
  
</article>
    <!-- Main view container ends -->
</div>
<!-- Div wrapper2 ends here -->

<script>
    $("#form").submit(function ()
    {
        //Ensure something was entered into the email field
        var email = $("#email").val();

        if (email == "") {
            $("#formError").attr('style', 'color:red; visibility:visible');
            return false;
        }
        else {
            $("#formError").attr('style', 'color:red; visibility:hidden');
            return true;
        }
    })
</script>